import axios from '@/utils/request';
import {Userinfo} from "@/model/userinfo";

//获取所有用户
export function getUserList(current: number, size: number) {
    return axios({
        url: `/user/user/getUserList/${current}/${size}`,
        method: "get"
    })
}

//新增用户
export function addUser(user: Userinfo) {
    return axios({
        url: "/user/user/addUser",
        method: "post",
        data: user
    })
}

//修改用户
export function updateUser(userinfo: Userinfo) {
    return axios({
        url: "/user/user/updateUser",
        method: "put",
        data: userinfo
    })
}

//禁用用户
export function deleteUser(ids: []) {
    return axios({
        url: "/user/user/deleteUser/" + ids,
        method: "put"
    })
}

//解禁用户
export function relieveUser(id: number) {
    return axios({
        url: "/user/user/relieveUser/" + id,
        method: "put"
    })
}

//根据id获取用户信息
export function getUser(id: number) {
    return axios({
        url: "/user/user/" + id,
        method: "get"
    })
}

//搜索
export function searchUser(searchParams: object) {
    return axios({
        url: "/user/user/searchUser",
        method: "post",
        data: searchParams
    })
}

//导出
export function exportUser() {
    return axios({
        url: "/user/user/exportUser",
        method: "get",
        responseType: 'blob',
    })
}

//获取所有用户昵称
export function getUserNickname() {
    return axios({
        url: "/user/user/getUserNickname",
        method: "get",
    })
}